home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
tcoop10a.zip
/
DOC.ZIP
/
ITEM.DOC
< prev
next >
Wrap
Text File
|
1991-11-20
|
3KB
|
69 lines
ITEM.DOC 11/10/91 Copyright (c) 1991 by James S. Clark
==========================================================================
ITEM
Item Class
--------------------------------------------------------------------------
Class Name Item
Superclass Node
Category List
Other classes referenced <node>
Other catagories referenced <none>
Used by <none>
Inherited by <none>
Declaration List *list = new List;
Instance Variables
char *name;
Instance Methods
Item (char *newname)
~Item (void)
static compare (void *node1, void *node2)
static find (void *node1, void *data)
void print (void)
--------------------------------------------------------------------------
GENERAL DESCRIPTION
The Item Class is derived from the Node Class and can therefore be used
by the List and Tree Classes as well as classes derived from them. To
the basic Node Class it adds a pointer to the Item name and also special
methods to compare, find, and print the item.
The compare and find methods are static so that their addresses may be
passed to a list upon creation. From that point on the list will call
the compare or find methods as required.
--------------------------------------------------------------------------
VARIABLES
char *name;
Pointer to the item name.
--------------------------------------------------------------------------
METHODS
Item (char *newname) { name = strdup(newname); }
Creates a new instance of Item and assign newname to
the name.
~Item (void) { delete name; }
Destructor deallocates the name of the Item.
static compare (void *node1, void *node2)
{ return(strcmp(((Item *) node1)->name,
((Item *) node2)->name)); }
Inline function to perform compare operations between
Items in the list.
static find (void *node1, void *data)
{ return(strcmp(((Item *) node1)->name,
(char *) data)); }
Inline function to perform find operations between
an item name and a character array.
void print (void) { puts(name); }
Prints the name of the Item on the display.
--------------------------------------------------------------------------
ITEM.DOC Copyright (c) 1991 by James S. Clark
==========================================================================